package com.cedric.yixianpai.game.cards.Sects.swordCards.d_YuanYing;

import com.cedric.yixianpai.game.Constants.CardType;
import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Yun_YueYing extends SwordCard {
    private int damageAdd;//加攻
    /**
     * title:云剑·月影
     * effect:防+1/2/3 连云：获得2/3/4层加攻
     */
    public Yun_YueYing(@Value("1") int lvl) {
        super("云剑·月影");
        this.setLevel(lvl);
        this.setPeriod(Period.YUANYING);
        this.setDescription("防+1/2/3 连云：获得2/3/4层加攻");
        this.setCardType(CardType.YUN);

        if (1 == lvl) {
            this.setShield(1);
            this.damageAdd=2;
        } else if (2 == lvl) {
            this.setShield(2);
            this.damageAdd=3;
        } else if (3 == lvl) {
            this.setShield(3);
            this.damageAdd=4;
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        Sta1.getPlayerBuff().addShield(this.getShield());
        if(Sta1.lastIs(CardType.YUN)){
            Sta1.getPlayerBuff().addAttackAdd(this.damageAdd);
        }
        return true;
    }
}
